package jsj.mynet;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class MyTcpServer implements Runnable {
	private ServerSocket ss;
	
	public MyTcpServer(ServerSocket ss) {
		super();
		this.ss = ss;
	}

	@Override
	public void run() {
		try {
			Socket s = ss.accept();
			BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
			String line = null;
			while((line = br.readLine())!= null){
				System.out.println(line);
			}
			s.close();
			ss.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		

	}

}
